<template>
  <v-container>
    <v-row no-gutters>
      <v-col cols="4">
        <v-card
            height="400"
            width="256"
            class="mx-auto"
        >
          <v-navigation-drawer permanent>
            <v-list-item>
              <v-list-item-content>
                <v-list-item-title class="text-h6" style="display: flex;justify-content: center;align-items: center;user-select: none">
                  菜单
                </v-list-item-title>
              </v-list-item-content>
            </v-list-item>

            <v-divider></v-divider>

            <v-list
                dense
                nav
            >
              <v-list-item
                  link
                  @click="toHome"
              >
                <v-list-item-content>
                  <v-list-item-title style="display: flex;justify-content: center">
                    首页
                  </v-list-item-title>
                </v-list-item-content>
              </v-list-item>
              <v-list-item
                  link
                  @click="toTaskManagement"
              >
                <v-list-item-content>
                  <v-list-item-title style="display: flex;justify-content: center">
                    任务管理
                  </v-list-item-title>
                </v-list-item-content>
              </v-list-item>
            </v-list>
          </v-navigation-drawer>
        </v-card>
      </v-col>
      <v-col cols="8">
        <router-view></router-view>
      </v-col>
    </v-row>
  </v-container>
</template>

<script>
export default {
  name: "home",
  watch: {
    $route(to) {
      if (to.fullPath === "/admin" || to.fullPath === "/admin/") {
        this.$router.push('/admin/home')
      }
    }
  },
  data() {
    return {}
  },
  mounted() {
    let path = this.$route.path
    if (path === '/admin' || path === '/admin/') {
      this.$router.push('/admin/home')
    }
  },
  methods: {
    toHome() {
      if (this.$route.path !== '/admin/home') {
        this.$router.push('/admin/home')
      }
    },
    toTaskManagement() {
      if (this.$route.path !== '/admin/task_management') {
        this.$router.push('/admin/task_management')
      }
    }
  }
}
</script>

<style scoped>

</style>